<?php

$cat_name = "[Mới nhất]";
$cat_title_link = get_link("news");
$rsNewsCat = getCategoryByLink($param[1]);
if($rsNewsCat['cat_id']) {
    $cat_name = $rsNewsCat["cat_title"];
    $cat_title_link = get_link("news","cat",$rsNewsCat["cat_link"]);
}

$site_title = $cat_name.' - Tin tức - '.$CONFIG['site_title'];

$site_keyword = $cat_name.', Tin tức, '.$CONFIG['site_title'];
$site_keyword = $site_keyword.', '.noSignSiteTitle($site_keyword);

$site_description = $cat_name.', Tin tức, '.$CONFIG['site_title'];
$site_description = $site_description .', '. noSignSiteTitle($site_description);
set_page_title_meta($site_title,$site_keyword,$site_description);
?>

<div class="center_news">
    <div class="center_news_tt_home" style="padding-left: 15px;width:95%">
        <div class="toplink" style="width: 100%; margin-top: 0px;padding-bottom: 10px;border-bottom: 1px solid #d1d1d1"><img src="/images/iconhome.gif" /><a href="#"><b>[Trang chủ]</b></a>&raquo;<a href="#" >[Tin tức]</a>&raquo;<a class="pagehere" href="<?php echo $cat_title_link; ?>" title="<?php echo htmlentities_utf8($cat_name); ?>"><?php echo $cat_name;?></a></div>


    </div>
    <?php
    //truyen vao cat_id va page
    $rsNews = getNewsByCatIdWithPaging(intval($rsNewsCat["cat_id"]),intval($param[2]));
    $i=0;
    while($news=$db->fetch_array($rsNews["news"])) {
        $i++;

        if($i==1) {
            $thumb = get_news_thumb($news["image"],"176-176");

            ?>

    <div class="news_top">
        <ul>
            <li>
                <a href="<?php echo get_link("news","detail",$news["title_link"]); ?>" title="<?php echo htmlentities_utf8($news["title"]); ?>" class="img_view"><img src="<?php echo SITE_URL.$thumb; ?>" /></a>

                <h2><a href="<?php echo get_link("news","detail",$news["title_link"]); ?>" title="<?php echo htmlentities_utf8($news["title"]); ?>"><?php echo $news["title"]; ?></a></h2><br>

                <p><?php echo get_my_date($news["create_date"]); ?></p>

                        <?php echo sum_str($news["description"],220); ?>

                <p class="viewmore"><a href="<?php echo get_link("news","detail",$news["title_link"]); ?>" title="<?php echo htmlentities_utf8($news["title"]); ?>" class="<?php echo $class; ?>">[Xem thêm]</a><img src="<?php echo SITE_IMAGES_URL; ?>/arrow3.gif" /></p>
            </li>
        </ul>
    </div>

        <?php }else {
            $lastNewsCreateDate = $news["create_date"];
            $thumb = get_news_thumb($news["image"],"100-100");?>


    <div class="news_top2">
        <ul>
            <li>
                <a href="<?php echo get_link("news","detail",$news["title_link"]); ?>" title="<?php echo htmlentities_utf8($news["title"]); ?>" class="thumb_news"><img src="<?php echo SITE_URL.$thumb; ?>" /></a>

                <h2><a href="<?php echo get_link("news","detail",$news["title_link"]); ?>" title="<?php echo htmlentities_utf8($news["title"]); ?>"><?php echo $news["title"]; ?></a></h2><br>

                <p><?php echo get_my_date($news["create_date"]); ?></p>

                        <?php echo sum_str($news["description"],220); ?>

                <p class="viewmore"><a href="<?php echo get_link("news","detail",$news["title_link"]); ?>" title="<?php echo htmlentities_utf8($news["title"]); ?>" class="<?php echo $class; ?>">[Xem thêm]</a><img src="<?php echo SITE_IMAGES_URL; ?>/arrow3.gif" /></p>
            </li>
        </ul>
    </div>

        <?php } ?>
    <?php } ?>

    <div class="news_paging">
        <?php
        if($rsNews["total"]>1&&!empty($params[1])) {
            echo paging($rsNews["page"],$rsNews["total"],get_link_page('news','cat',$rsNewsCat["cat_link"]));
        }
        ?>
    </div>
    <?php
    $rsLastOtherNews = getOrtherNewsByCat($rsNewsCat["cat_id"], $lastNewsCreateDate);
    if($db->num_rows($rsLastOtherNews)) {
        ?>
    <div class="othernew_title"><img src="/images/icon2.gif" />[Các bài đã đăng]</div>
    <div class="link_othernews">
            <?php
            while($otherNews=$db->fetch_array($rsLastOtherNews)) {
                ?>
        <img src="/images/point2.gif" alt="<?php echo $otherNews['title'];?>" /><a href="<?php echo get_link("news","detail",$otherNews["title_link"]); ?>" title="<?php echo $otherNews['title'];?>"><?php echo $otherNews['title'];?> (<?php echo get_my_date($otherNews["create_date"]); ?>)</a><br />
            <?php }?>
    </div>
    <?php }?>
</div>